package cn.edu.wit.servlets;

import cn.edu.wit.dao.StudentDAO;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class StudentDeleteServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String stuNum = request.getParameter("snum");
		
		boolean b = new StudentDAO().deleteStudent(stuNum);
		
	
		String tips = b?"<label style='color:green'>ѧ��ɾ���ɹ���</label>":"<label style='color:red'>ѧ��ɾ��ʧ�ܣ�</label>";
		request.setAttribute("tips", tips);
		request.getRequestDispatcher("prompt.jsp").forward(request, response);
				
				
	}
}
